package com.crazymo.replaceskin;

import android.app.Application;
import android.support.v7.app.AppCompatDelegate;
import android.util.Log;

import com.crazymo.moskin.core.SkinManager;
import com.crazymo.moskin.core.Util;

/**
 * @author : Crazy.Mo
 */
public class MoApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        SkinManager.init(this);
        if((Boolean) Util.SharePreference.get(this,"config_skin","isNight",false)) {
            Log.e("cmskin","日间");
            AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
            Util.SharePreference.save(this,"config_skin","isNight",false);
        }else {
            AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
            Log.e("cmskin","夜间");
            Util.SharePreference.save(this,"config_skin","isNight",true);
        }
    }
}
